package com.aner.test.controller;
import com.aner.tester.controller.BaseControllerTest;
import org.junit.Test;
import org.junit.runner.RunWith;
import com.aner.tester.utils.text.StringUtils;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;


/**
 * GetTestControllerTest class
 * 
 * @author aner
 * @date 2020-12-30
 */
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@RunWith(SpringRunner.class)
@AutoConfigureMockMvc
public class GetTestControllerTest extends BaseControllerTest
{

    @Test
    public void testTest() {
        String params = "{'booleanTest':false,'byteTest':0,'dateTest':'2020-12-30 13:39:02','doubleTest':0.9025237286201916,'floatTest':0.88646597,'intTest':0,'longTest':1,'stringTest':'猪第小'}";
        String jsonStr = StringUtils.replaceSingleQuoteWithDouble(params);
                    this.get("/test/", jsonStr);
        
    }
    @Test
    public void testRequestParamDateTest() {
        String params = "{'testDate':'2020-12-30 13:39:02'}";
        String jsonStr = StringUtils.replaceSingleQuoteWithDouble(params);
                    this.get("/testRequestParamDate/", jsonStr);
        
    }
    @Test
    public void testRequestParamListTest() {
        String params = "{'testList':['事个','三狗广的3狗','尔三猫','的个小猪','0尔1']}";
        String jsonStr = StringUtils.replaceSingleQuoteWithDouble(params);
                    this.get("/testRequestParamList/", jsonStr);
        
    }
    @Test
    public void testPathVariableTest() {
        String params = "{'params':['2狗','狗尔1司狗狗'],'id':[2,1]}";
        String jsonStr = StringUtils.replaceSingleQuoteWithDouble(params);
                    this.get("/testPathVariable/{params}/{id}", jsonStr);
        
    }
    @Test
    public void testDateTest() {
        String params = "{'test':'2020-12-30 13:39:02'}";
        String jsonStr = StringUtils.replaceSingleQuoteWithDouble(params);
                    this.get("/testDate/", jsonStr);
        
    }
}
